﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using LibrarySystem.LibraryUtils.DAL.DAOs;

namespace LibrarySystem.Controllers
{
    public class AdminController : Controller
    {
        //
        // GET: /Admin/
        [Authorize(Roles = "Administrator, Super Administrator")]
        public ActionResult Index()
        {
            return View();
        }

        //
        // GET: /Admin/QuanLySach
        [Authorize(Roles = "Administrator, Super Administrator")]
        public ActionResult QuanLySach()
        {
            Library_Categories libCat = new Library_Categories();
            var cateFilter = libCat.GetCateComboxList().Select(c => new SelectListItem { Text = c.CategoryName, Value = c.ID.ToString() }).ToList();
            cateFilter.Insert(0, new SelectListItem { Selected = true, Value = "", Text = "---Chọn thể loại---" });
            ViewBag.Categories = cateFilter;
            return View();
        }

        //
        // GET: /Admin/QuanLySinhVien
        [Authorize(Roles = "Administrator, Super Administrator")]
        public ActionResult QuanLySinhVien()
        {
            return View();
        }

        //
        // GET: /Admin/QuanLyDonMuonSach
        [Authorize(Roles = "Administrator, Super Administrator")]
        public ActionResult QuanLyDonMuonSach()
        {
            Library_Employees libEmp = new Library_Employees();
            var empFilter = libEmp.getEmpToComboBox().Select(c => new SelectListItem { Text = c.UserName, Value = c.ID.ToString() }).ToList();
            empFilter.Insert(0, new SelectListItem { Selected = true, Value = "", Text = "---Nhân viên---" });
            ViewBag.Employees = empFilter;
            return View();
        }

        //
        // GET: /Admin/QuanLyTheLoai
        [Authorize(Roles = "Administrator, Super Administrator")]
        public ActionResult QuanLyTheLoai()
        {
            Library_Employees libEmp = new Library_Employees();
            var empFilter = libEmp.getEmpToComboBox().Select(c => new SelectListItem { Text = c.UserName, Value = c.ID.ToString() }).ToList();
            empFilter.Insert(0, new SelectListItem { Selected = true, Value = "", Text = "---Nhân viên---" });
            ViewBag.Employees = empFilter;
            return View();
        }

        //
        // GET: /Admin/QuanLyBienLai
        [Authorize(Roles = "Administrator, Super Administrator")]
        public ActionResult QuanLyBienLai()
        {
            Library_Employees libEmp = new Library_Employees();
            var empFilter = libEmp.getEmpToComboBox().Select(c => new SelectListItem { Text = c.UserName, Value = c.ID.ToString() }).ToList();
            empFilter.Insert(0, new SelectListItem { Selected = true, Value = "", Text = "---Nhân viên---" });
            ViewBag.Employees = empFilter;
            return View();
        }

        //
        // GET: /Admin/QuanLyNhanVien
        [Authorize(Roles = "Super Administrator")]
        public ActionResult QuanLyNhanVien()
        {
            return View();
        }

        //
        // GET: /Admin/QuanLyDonTraMuonSach
        [Authorize(Roles = "Administrator, Super Administrator")]
        public ActionResult QuanLyDonTraMuonSach()
        {
            Library_Employees libEmp = new Library_Employees();
            var empFilter = libEmp.getEmpToComboBox().Select(c => new SelectListItem { Text = c.UserName, Value = c.ID.ToString() }).ToList();
            empFilter.Insert(0, new SelectListItem { Selected = true, Value = "", Text = "---Nhân viên---" });
            ViewBag.Employees = empFilter;
            return View();
        }
    }
}
